package lnu.project.cart.entity;

public class Product {
	/* get; */
	private long id;
	public static String ID = "ID";

	/* get; */
	public static String BASKET_ID = "BASKET_ID";

	/* get; set; */
	private int typeOfProduct;
	public static String TYPE_OF_PRODUCT = "TYPE_OF_PRODUCT";

	/* get; set; */
	private String name;
	public static String NAME = "NAME";

	/* get; set; */
	private String barcode;
	public static String BARCODE = "BARCODE";

	/* get; set; */
	private int quantity;
	public static String QUANTITY = "QUANTITY";

	/* get; set; */
	private float weight;
	public static String WEIGHT = "WEIGHT";

	/* get; set; */
	private float price;
	public static String PRICE = "PRICE";
	
	public Product(int typeOfProduct, String name,
			String barcode, int quantity, float weight, float price)
	{
		this.typeOfProduct = typeOfProduct;
		this.name = name;
		this.barcode = barcode;
		this.quantity = quantity;
		this.weight = weight;
		this.price = price;
	}

	public Product(long id, int typeOfProduct, String name,
			String barcode, int quantity, float d, float e) {
		this.id = id;
		this.typeOfProduct = typeOfProduct;
		this.name = name;
		this.barcode = barcode;
		this.quantity = quantity;
		this.weight = d;
		this.price = e;
	}

	/* START SET;GET; AREA */
	public long getId() {
		return this.id;
	}

	/* END SET;GET; AREA */

	/* START SET;GET; AREA */
	public int getTypeOfProduct() {
		return this.typeOfProduct;
	}

	public void setTypeOfProduct(int typeOfProduct) {
		this.typeOfProduct = typeOfProduct;
	}

	/* END SET;GET; AREA */

	/* START SET;GET; AREA */
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	/* END SET;GET; AREA */

	/* START SET;GET; AREA */
	public String getBarcode() {
		return this.barcode;
	}

	public void setBarcode(String barcode) {
		this.barcode = barcode;
	}

	/* END SET;GET; AREA */

	/* START SET;GET; AREA */
	public int getQuantity() {
		return this.quantity;
	}

	public void setQuantity(int quantity) {
		this.quantity = quantity;
	}

	/* END SET;GET; AREA */

	/* START SET;GET; AREA */
	public float getWeight() {
		return this.weight;
	}

	public void setWeight(float weight) {
		this.weight = weight;
	}

	/* END SET;GET; AREA */

	/* START SET;GET; AREA */
	public float getPrice() {
		return this.price;
	}

	public void setPrice(float price) {
		this.price = price;
	}
	/* END SET;GET; AREA */
	
	public float GetTotalPrice(){
		if(this.typeOfProduct == 0){
			return this.quantity * this.price;
		}else if(this.typeOfProduct == 1){
			return this.weight * this.price;
		}
		return -1;
	}
}
